<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>Student form</title>
</head>
<body th:object="${student}">
<h1 th:if="*{id}">Edit student</h1>
<h1 th:unless="*{id}">Add a student</h1>
<form method="post"
      th:action="@{*{id}==null?'/student/add':'/student/edit'}">
    <table border="1" width="100%">
        <input type="hidden" th:field="*{id}">
        <span th:errors="*{id}">Id Error</span>
        <tr>
            <td>No.</td>
            <td><input type="text" th:field="*{no}" /></td>
            <td th:errors="*{no}">No. Error</td>
        </tr>
        <tr>
            <td>Firstname</td>
            <td><input th:field="*{firstname}"></td>
            <td th:errors="*{firstname}">Firstname Error</td>
        </tr>
        <tr>
            <td>Lastname</td>
            <td><input th:field="*{lastname}"></td>
            <td th:errors="*{lastname}">Lastname Error</td>
        </tr>
        <tr>
            <td>Gender</td>
            <td>
                <input type="radio" th:field="*{gender}" value="M">男
                <input type="radio" th:field="*{gender}" value="F">女
            </td>
            <td th:errors="*{gender}">Gender Error</td>
        </tr>
        <tr>
            <td>Birthday</td>
            <td><input type="date" th:field="*{birthday}"></td>
            <td th:errors="*{birthday}">Birthday Error</td>
        </tr>
        <tr>
            <td>Email</td>
            <td><input type="email" th:field="*{email}"></td>
            <td th:errors="*{email}">Email Error</td>
        </tr>
        <tr>
            <td></td>
            <td><input type="reset"><input type="submit"></td>
        </tr>
    </table>
</form>
</body>
</html>
